package com.jxl.mapper;

import com.github.pagehelper.Page;
import com.jxl.pojo.dto.UserPageQueryDTO;
import com.jxl.pojo.entity.Users;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    /**
     * 根据id查询用户信息
     * @param UserId
     * @return
     */
    @Select("select * from users where user_id = #{UserId}")
    Users getUsersById(Long UserId);

    /**
     * 分页查询用户信息
     * @param userPageQueryDTO
     * @return
     */
    Page<Users> pageQuery(UserPageQueryDTO userPageQueryDTO);

    /**
     * 新增用户信息
     * @param users
     */
    @Insert("insert into users(username,password_hash,email,phone,registration_date,account_updated_at,is_enabled) values(#{username},#{passwordHash},#{email},#{phone},#{registrationDate},#{accountUpdatedAt},#{isEnabled})")
    void insert(Users users);

    /**
     * 修改用户信息
     * @param users
     */
    void update(Users users);
}
